import { Component, NgZone, OnInit } from '@angular/core';
import { registerMicroApps, start } from 'qiankun';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
})
export class AppComponent implements OnInit {

  constructor(private ngZone: NgZone) {
    (window as any).ngZone = this.ngZone;
  }

  ngOnInit(): void {
    const container = '#container';
    registerMicroApps([
      {
        name: 'shopApp',
        entry: '//localhost:4201',
        activeRule: '/shop',
        container,
      },
      {
        name: 'logisticsApp',
        entry: '//localhost:4202',
        activeRule: '/logistics',
        container,
      },
    ]);
    // 启动 qiankun
    start();
  }
}
